﻿<cfscript>
/** 
* ORM QuestionRespondent
* 
* @hint "Hibernate persistenter t_respondents. 调查问卷预设允许答题学生范围" 
* 
*/ 

component 
	displayname="public.service.orm.senate.QuestionRespondent" 
	output=false 
	persistent=true 
	selectBeforeUpdate=true dynamicInsert=true dynamicUpdate=true 
	cacheuse="Transactional" 
	entityname="QuestionRespondent" 
	table="t_respondents"
	{
	
	property type="string" name="ResponderID" column="rsp_id" fieldtype="id" generator="assigned" hint="调查对象编号";
	
	property type="string" name="State" column="state" hint="问卷完成状态";
	property type="string" name="LastUpdate" column="last_update" hint="问卷回答时间";
	
	property name="Questionnaire" fieldtype="many-to-one" fkcolumn="qsn_id" cfc="Questionnaire"  hint="调查问卷";
	property name="Student" fieldtype="many-to-one" fkcolumn="stu_id" cfc="Student"  hint="学生";
	
	/**
	* @hint "自定义主键规则"
	* 
	* @Questionnaire "调查问卷"
	* @Student "学生"
	*/
	public string function getID( required Questionnaire, required Student ) output=false {
		
		var nextID = arguments.Questionnaire.getQueID() & "," & arguments.Student.getStudentID();

		/* 
			主键生成规则 
			
			调查对象编号30位 8位调查问卷编号 , 20位学号

			Unique: qsn_id, stu_id
		*/
		return nextID;
	}
	
}

</cfscript>